package com.example.demo.common;

public enum ResultCode {

    SUCCESS(200, "操作成功"),
    FAILURE(400, "操作失败"),
    UNAUTHORIZED(401, "未登录或登录已过期"),
    FORBIDDEN(403, "没有权限访问"),
    NOT_FOUND(404, "资源不存在"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    
    VALIDATION_ERROR(40001, "参数校验失败"),
    BUSINESS_ERROR(40002, "业务逻辑错误"),
    DATABASE_ERROR(50001, "数据库操作失败"),
    FILE_UPLOAD_ERROR(50002, "文件上传失败"),
    NETWORK_ERROR(50003, "网络连接失败");

    private final int code;
    private final String msg;

    ResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}